import { useEffect } from "react"

/**
 * 组件初始化时执行
 * @param callback - 回调函数
 */
const useMount = (callback: () => void) => {
  useEffect(() => {
    callback?.()
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [])
}

export default useMount
